using System;
using System.Xml;
using UnityEngine;
namespace AssemblyCSharp
{
	public class RevolutionDAO : XmlParserDAO, CommonDAOIF<RevolutionDomain>
	{
		public RevolutionDAO ()
		{
		}

		private RevolutionDomain mRevolutionDomain = null;
		
		public bool readStarXml(String xmlString)
		{
			return mXmlParser.readXmlString(xmlString);
		}
		
		public override System.Object parse()
		{
			try
			{
				String returnValue = "";
				mRevolutionDomain = new RevolutionDomain();
				
				foreach(XmlNode item in mXmlParser.xmlDoc.ChildNodes)
				{
					GetChildren(item);
				}
				
				return returnValue;
			}
			catch ( Exception e )
			{
				Debug.Log( e.ToString());
				return null;
			}
		}
		
		private void GetChildren(XmlNode node)
		{
			if (node.LocalName == Constant.RevolutionClockwise) {
				mRevolutionDomain.RevolutionClickwise = Convert.ToInt32(node.InnerText);
			} else if (node.LocalName == Constant.Revolutioniaxis) {
				mRevolutionDomain.RevolutioniAxis = Convert.ToInt32(node.InnerText);
			} else if (node.LocalName == Constant.RevolutionMaxDistance) {
				mRevolutionDomain.RevolutionMaxDistance = Convert.ToInt32(node.InnerText);
			} else if (node.LocalName == Constant.RevolutionMinDistance) {
				mRevolutionDomain.RevolutionMinDistance = Convert.ToInt32(node.InnerText);
			} else if (node.LocalName == Constant.Revolutionoaixs) {
				mRevolutionDomain.RevolutionoAxis = Convert.ToInt32(node.InnerText);
			} else if (node.LocalName == Constant.RevolutionTime) {
				mRevolutionDomain.RevolutionTime = Convert.ToInt32(node.InnerText);
			} 
			else
			{
				foreach (XmlNode item in node.ChildNodes)
				{
					GetChildren(item);
				}
			}
		}
		
		public RevolutionDomain getDomain ()
		{
			return mRevolutionDomain;
		}
	}
}

